#include "renderthread.h"
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <qdebug.h>
#include "remotecall.h"

RenderThread::RenderThread() {
    start();
    pause();
}

RenderThread::~RenderThread()
{
    pause(1);
    exit();
}

void RenderThread::render()
{
    QThread::usleep(1000000/60);
    if(isPause) return;
    qDebug() << "::线程运行中...";
    RemoteCall remoteCall; // 远程call
    remoteCall.run();
    while (!isPause) {
        do{
            QString data = remoteCall.Call_fun_rect(1920, 1080);
            if(data.isEmpty()) break;
            qDebug() << data;
        }while(0);
        QThread::sleep(1);
    }
}

void RenderThread::SetIpAndPort(QString text1_tmp, QString text2_tmp)
{
    text1=text1_tmp;
    text2=text2_tmp;
}
